<template>
  <form id="login">
    <div class="form-group">
      <label class="sr-only" for="userAccount">Amount (in dollars)</label>
      <div class="input-group">
        <div class="input-group-addon">账户</div>
        <input type="text" class="form-control" v-model="userAccount"

               placeholder="请输入您的帐号">
      </div>
    </div>
    <div class="form-group">
      <label class="sr-only" for="userPassword">Amount (in dollars)</label>
      <div class="input-group">
        <div class="input-group-addon">密码</div>
        <input type="password" class="form-control" v-model="userPassword" placeholder="请输入您的密码">
      </div>
    </div>
    <div class="checkbox">
      <div class="col-md-6">
        <label>
          <input type="checkbox">
          记住密码
        </label>
      </div>
      <div class="col-md-6 text-right">
        <router-link to="/register">立即注册</router-link>
        <!--<a href="javascript:;">立即注册</a>-->
      </div>
      <div class="clearfix"></div>
    </div>

    <button type="button" @click="loginIn" class="btn btn-success btn-block">登录</button>
  </form>
</template>

<script>
  import loginService from '@/service/loginService';
export default {
  name: 'app',
  data(){
  	return{
      userAccount:'',
      userPassword:''
    }
  },
  methods:{
   async loginIn(){
      let res =await loginService.userLogin({userAccount:this.userAccount,userPassword:this.userPassword});
      if(res.code){
      	location.href='admin.html';
      }else{
      	alert(res.msg)
      }
    }
  }
}
</script>

